<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE CPP, MagicHash, UnboxedTuples, NoImplicitPrelude #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Module      :  GHC.Float.RealFracMethods</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Copyright   :  (c) Daniel Fischer 2010</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Portability :  non-portable (GHC Extensions)</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Methods for the RealFrac instances for 'Float' and 'Double',</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- with specialised versions for 'Int'.</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Moved to their own module to not bloat GHC.Float further.</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span class="hs-cpp">

#include &quot;MachDeps.h&quot;
</span><span>
</span><span id="line-24"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Float.RealFracMethods</span><span>
</span><span id="line-25"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-comment">-- * Double methods</span></span><span>
</span><span id="line-26"></span><span>      </span><span class="annot"><span class="hs-comment">-- ** Integer results</span></span><span>
</span><span id="line-27"></span><span>      </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionDoubleInteger"><span class="hs-identifier">properFractionDoubleInteger</span></a></span><span>
</span><span id="line-28"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#truncateDoubleInteger"><span class="hs-identifier">truncateDoubleInteger</span></a></span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorDoubleInteger"><span class="hs-identifier">floorDoubleInteger</span></a></span><span>
</span><span id="line-30"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingDoubleInteger"><span class="hs-identifier">ceilingDoubleInteger</span></a></span><span>
</span><span id="line-31"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundDoubleInteger"><span class="hs-identifier">roundDoubleInteger</span></a></span><span>
</span><span id="line-32"></span><span>      </span><span class="annot"><span class="hs-comment">-- ** Int results</span></span><span>
</span><span id="line-33"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionDoubleInt"><span class="hs-identifier">properFractionDoubleInt</span></a></span><span>
</span><span id="line-34"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorDoubleInt"><span class="hs-identifier">floorDoubleInt</span></a></span><span>
</span><span id="line-35"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingDoubleInt"><span class="hs-identifier">ceilingDoubleInt</span></a></span><span>
</span><span id="line-36"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundDoubleInt"><span class="hs-identifier">roundDoubleInt</span></a></span><span>
</span><span id="line-37"></span><span>      </span><span class="annot"><span class="hs-comment">-- * Double/Int conversions, wrapped primops</span></span><span>
</span><span id="line-38"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#double2Int"><span class="hs-identifier">double2Int</span></a></span><span>
</span><span id="line-39"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#int2Double"><span class="hs-identifier">int2Double</span></a></span><span>
</span><span id="line-40"></span><span>      </span><span class="annot"><span class="hs-comment">-- * Float methods</span></span><span>
</span><span id="line-41"></span><span>      </span><span class="annot"><span class="hs-comment">-- ** Integer results</span></span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionFloatInteger"><span class="hs-identifier">properFractionFloatInteger</span></a></span><span>
</span><span id="line-43"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#truncateFloatInteger"><span class="hs-identifier">truncateFloatInteger</span></a></span><span>
</span><span id="line-44"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorFloatInteger"><span class="hs-identifier">floorFloatInteger</span></a></span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingFloatInteger"><span class="hs-identifier">ceilingFloatInteger</span></a></span><span>
</span><span id="line-46"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundFloatInteger"><span class="hs-identifier">roundFloatInteger</span></a></span><span>
</span><span id="line-47"></span><span>      </span><span class="annot"><span class="hs-comment">-- ** Int results</span></span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionFloatInt"><span class="hs-identifier">properFractionFloatInt</span></a></span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorFloatInt"><span class="hs-identifier">floorFloatInt</span></a></span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingFloatInt"><span class="hs-identifier">ceilingFloatInt</span></a></span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundFloatInt"><span class="hs-identifier">roundFloatInt</span></a></span><span>
</span><span id="line-52"></span><span>      </span><span class="annot"><span class="hs-comment">-- * Float/Int conversions, wrapped primops</span></span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#float2Int"><span class="hs-identifier">float2Int</span></a></span><span>
</span><span id="line-54"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#int2Float"><span class="hs-identifier">int2Float</span></a></span><span>
</span><span id="line-55"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#"><span class="hs-identifier">GHC.Num.Integer</span></a></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Num.html"><span class="hs-identifier">GHC.Num</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">

#if WORD_SIZE_IN_BITS &lt; 64
</span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.IntWord64</span><span class="hs-cpp">

#define TO64 integerToInt64#
</span><span class="hs-cpp">#define FROM64 integerFromInt64#
</span><span class="hs-cpp">#define MINUS64 minusInt64#
</span><span class="hs-cpp">#define NEGATE64 negateInt64#
</span><span class="hs-cpp">
#else
</span><span class="hs-cpp">
#define TO64 integerToInt#
</span><span class="hs-cpp">#define FROM64 IS
</span><span class="hs-cpp">#define MINUS64 ( -# )
</span><span class="hs-cpp">#define NEGATE64 negateInt#
</span><span>
</span><span id="line-78"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#uncheckedIShiftRA64%23"><span class="hs-identifier hs-type">uncheckedIShiftRA64#</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-79"></span><span id="uncheckedIShiftRA64%23"><span class="annot"><span class="annottext">uncheckedIShiftRA64# :: Int# -&gt; Int# -&gt; Int#
</span><a href="GHC.Float.RealFracMethods.html#uncheckedIShiftRA64%23"><span class="hs-identifier hs-var hs-var">uncheckedIShiftRA64#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftRA%23"><span class="hs-identifier hs-var">uncheckedIShiftRA#</span></a></span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#uncheckedIShiftL64%23"><span class="hs-identifier hs-type">uncheckedIShiftL64#</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-82"></span><span id="uncheckedIShiftL64%23"><span class="annot"><span class="annottext">uncheckedIShiftL64# :: Int# -&gt; Int# -&gt; Int#
</span><a href="GHC.Float.RealFracMethods.html#uncheckedIShiftL64%23"><span class="hs-identifier hs-var hs-var">uncheckedIShiftL64#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftL%23"><span class="hs-identifier hs-var">uncheckedIShiftL#</span></a></span><span class="hs-cpp">

#endif
</span><span>
</span><span id="line-86"></span><span class="hs-keyword">default</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-89"></span><span class="hs-comment">--                              Float Methods                               --</span><span>
</span><span id="line-90"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-comment">-- Special Functions for Int, nice, easy and fast.</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- They should be small enough to be inlined automatically.</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="hs-comment">-- We have to test for &#177;0.0 to avoid returning -0.0 in the second</span><span>
</span><span id="line-96"></span><span class="hs-comment">-- component of the pair. Unfortunately the branching costs a lot</span><span>
</span><span id="line-97"></span><span class="hs-comment">-- of performance.</span><span>
</span><span id="line-98"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionFloatInt"><span class="hs-identifier hs-type">properFractionFloatInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-99"></span><span id="properFractionFloatInt"><span class="annot"><span class="annottext">properFractionFloatInt :: Float -&gt; (Int, Float)
</span><a href="GHC.Float.RealFracMethods.html#properFractionFloatInt"><span class="hs-identifier hs-var hs-var">properFractionFloatInt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-type">F#</span></a></span><span> </span><span id="local-6989586621679500357"><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500357"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500357"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#eqFloat%23"><span class="hs-operator hs-var">`eqFloat#`</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><span class="hs-number">0.0#</span></span><span class="hs-special">)</span><span>
</span><span id="line-101"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float
</span><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-var">F#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><span class="hs-number">0.0#</span></span><span class="hs-special">)</span><span>
</span><span id="line-102"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#float2Int%23"><span class="hs-identifier hs-var">float2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500357"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-103"></span><span>                </span><span id="local-6989586621679500355"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500355"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500355"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float
</span><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-var">F#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500357"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float# -&gt; Float#
</span><a href="../../ghc-prim/src/GHC.Prim.html#minusFloat%23"><span class="hs-operator hs-var">`minusFloat#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Float#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Float%23"><span class="hs-identifier hs-var">int2Float#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500355"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="hs-comment">-- truncateFloatInt = float2Int</span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorFloatInt"><span class="hs-identifier hs-type">floorFloatInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-108"></span><span id="floorFloatInt"><span class="annot"><span class="annottext">floorFloatInt :: Float -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#floorFloatInt"><span class="hs-identifier hs-var hs-var">floorFloatInt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-type">F#</span></a></span><span> </span><span id="local-6989586621679500354"><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500354"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#float2Int%23"><span class="hs-identifier hs-var">float2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500354"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-110"></span><span>      </span><span id="local-6989586621679500353"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500353"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500354"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#ltFloat%23"><span class="hs-operator hs-var">`ltFloat#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Float#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Float%23"><span class="hs-identifier hs-var">int2Float#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500353"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500353"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">1#</span></span><span class="hs-special">)</span><span>
</span><span id="line-111"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500353"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingFloatInt"><span class="hs-identifier hs-type">ceilingFloatInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-114"></span><span id="ceilingFloatInt"><span class="annot"><span class="annottext">ceilingFloatInt :: Float -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#ceilingFloatInt"><span class="hs-identifier hs-var hs-var">ceilingFloatInt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-type">F#</span></a></span><span> </span><span id="local-6989586621679500352"><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500352"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#float2Int%23"><span class="hs-identifier hs-var">float2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500352"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-116"></span><span>      </span><span id="local-6989586621679500351"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500351"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Float#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Float%23"><span class="hs-identifier hs-var">int2Float#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500351"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#ltFloat%23"><span class="hs-operator hs-var">`ltFloat#`</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500352"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500351"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%2B%23"><span class="hs-operator hs-var">+#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">1#</span></span><span class="hs-special">)</span><span>
</span><span id="line-117"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500351"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundFloatInt"><span class="hs-identifier hs-type">roundFloatInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-120"></span><span id="roundFloatInt"><span class="annot"><span class="annottext">roundFloatInt :: Float -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#roundFloatInt"><span class="hs-identifier hs-var hs-var">roundFloatInt</span></a></span></span><span> </span><span id="local-6989586621679500350"><span class="annot"><span class="annottext">Float
</span><a href="#local-6989586621679500350"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Float -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#float2Int"><span class="hs-identifier hs-var">float2Int</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float -&gt; Float
</span><a href="GHC.Float.RealFracMethods.html#c_rintFloat"><span class="hs-identifier hs-var">c_rintFloat</span></a></span><span> </span><span class="annot"><span class="annottext">Float
</span><a href="#local-6989586621679500350"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span class="hs-comment">-- Functions with Integer results</span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span class="hs-comment">-- With the new code generator in GHC 7, the explicit bit-fiddling is</span><span>
</span><span id="line-125"></span><span class="hs-comment">-- slower than the old code for values of small modulus, but when the</span><span>
</span><span id="line-126"></span><span class="hs-comment">-- 'Int' range is left, the bit-fiddling quickly wins big, so we use that.</span><span>
</span><span id="line-127"></span><span class="hs-comment">-- If the methods are called on smallish values, hopefully people go</span><span>
</span><span id="line-128"></span><span class="hs-comment">-- through Int and not larger types.</span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span class="hs-comment">-- Note: For negative exponents, we must check the validity of the shift</span><span>
</span><span id="line-131"></span><span class="hs-comment">-- distance for the right shifts of the mantissa.</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionFloatInteger"><span class="hs-pragma hs-type">properFractionFloatInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-134"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionFloatInteger"><span class="hs-identifier hs-type">properFractionFloatInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span id="properFractionFloatInteger"><span class="annot"><span class="annottext">properFractionFloatInteger :: Float -&gt; (Integer, Float)
</span><a href="GHC.Float.RealFracMethods.html#properFractionFloatInteger"><span class="hs-identifier hs-var hs-var">properFractionFloatInteger</span></a></span></span><span> </span><span id="local-6989586621679500348"><span class="annot"><span class="annottext">v :: Float
</span><a href="#local-6989586621679500348"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-type">F#</span></a></span><span> </span><span id="local-6989586621679500347"><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500347"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; (# Int#, Int# #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#decodeFloat_Int%23"><span class="hs-identifier hs-var">decodeFloat_Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500347"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-137"></span><span>      </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679500346"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500346"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679500345"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500345"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-138"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500345"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23"><span class="hs-operator hs-var">&lt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-139"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500345"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-140"></span><span>            </span><span id="local-6989586621679500344"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500344"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500344"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%23"><span class="hs-operator hs-var">&gt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">23#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Float
</span><a href="#local-6989586621679500348"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500346"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23"><span class="hs-operator hs-var">&lt;#</span></a></span><span>  </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-142"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500346"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftRA%23"><span class="hs-operator hs-var">`uncheckedIShiftRA#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500344"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-143"></span><span>                  </span><span id="local-6989586621679500343"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500343"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500343"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-144"></span><span>                            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500346"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500343"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftL%23"><span class="hs-operator hs-var">`uncheckedIShiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500344"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-145"></span><span>                              </span><span id="local-6989586621679500342"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500342"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float
</span><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-var">F#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int# -&gt; Float#
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerEncodeFloat%23"><span class="hs-identifier hs-var">integerEncodeFloat#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500342"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500345"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-147"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500346"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftRL%23"><span class="hs-operator hs-var">`uncheckedIShiftRL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500344"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-148"></span><span>                  </span><span id="local-6989586621679500341"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500341"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500341"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-149"></span><span>                            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500346"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500341"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftL%23"><span class="hs-operator hs-var">`uncheckedIShiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500344"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-150"></span><span>                              </span><span id="local-6989586621679500340"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500340"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float
</span><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-var">F#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int# -&gt; Float#
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerEncodeFloat%23"><span class="hs-identifier hs-var">integerEncodeFloat#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500340"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500345"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-151"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Word# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftL%23"><span class="hs-identifier hs-var">integerShiftL#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500346"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500345"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float
</span><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-var">F#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><span class="hs-number">0.0#</span></span><span class="hs-special">)</span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#truncateFloatInteger"><span class="hs-pragma hs-type">truncateFloatInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-154"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#truncateFloatInteger"><span class="hs-identifier hs-type">truncateFloatInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-155"></span><span id="truncateFloatInteger"><span class="annot"><span class="annottext">truncateFloatInteger :: Float -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#truncateFloatInteger"><span class="hs-identifier hs-var hs-var">truncateFloatInteger</span></a></span></span><span> </span><span id="local-6989586621679500339"><span class="annot"><span class="annottext">Float
</span><a href="#local-6989586621679500339"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Float -&gt; (Integer, Float)
</span><a href="GHC.Float.RealFracMethods.html#properFractionFloatInteger"><span class="hs-identifier hs-var">properFractionFloatInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Float
</span><a href="#local-6989586621679500339"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-157"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621679500338"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500338"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Float
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500338"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span class="hs-comment">-- floor is easier for negative numbers than truncate, so this gets its</span><span>
</span><span id="line-160"></span><span class="hs-comment">-- own implementation, it's a little faster.</span><span>
</span><span id="line-161"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorFloatInteger"><span class="hs-pragma hs-type">floorFloatInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-162"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorFloatInteger"><span class="hs-identifier hs-type">floorFloatInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-163"></span><span id="floorFloatInteger"><span class="annot"><span class="annottext">floorFloatInteger :: Float -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#floorFloatInteger"><span class="hs-identifier hs-var hs-var">floorFloatInteger</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-type">F#</span></a></span><span> </span><span id="local-6989586621679500337"><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500337"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-164"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; (# Int#, Int# #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#decodeFloat_Int%23"><span class="hs-identifier hs-var">decodeFloat_Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500337"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-165"></span><span>      </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679500336"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500336"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679500335"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500335"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-166"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500335"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23"><span class="hs-operator hs-var">&lt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-167"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500335"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-168"></span><span>            </span><span id="local-6989586621679500334"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500334"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500334"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%23"><span class="hs-operator hs-var">&gt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">23#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500336"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23"><span class="hs-operator hs-var">&lt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span>
</span><span id="line-169"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500336"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftRA%23"><span class="hs-operator hs-var">`uncheckedIShiftRA#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500334"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftL%23"><span class="hs-identifier hs-var">integerShiftL#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500336"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500335"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span class="hs-comment">-- ceiling x = -floor (-x)</span><span>
</span><span id="line-173"></span><span class="hs-comment">-- If giving this its own implementation is faster at all,</span><span>
</span><span id="line-174"></span><span class="hs-comment">-- it's only marginally so, hence we keep it short.</span><span>
</span><span id="line-175"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingFloatInteger"><span class="hs-pragma hs-type">ceilingFloatInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-176"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingFloatInteger"><span class="hs-identifier hs-type">ceilingFloatInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-177"></span><span id="ceilingFloatInteger"><span class="annot"><span class="annottext">ceilingFloatInteger :: Float -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#ceilingFloatInteger"><span class="hs-identifier hs-var hs-var">ceilingFloatInteger</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-type">F#</span></a></span><span> </span><span id="local-6989586621679500333"><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500333"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-178"></span><span>    </span><span class="annot"><span class="annottext">Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerNegate"><span class="hs-identifier hs-var">integerNegate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#floorFloatInteger"><span class="hs-identifier hs-var">floorFloatInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float# -&gt; Float
</span><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-var">F#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float# -&gt; Float#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateFloat%23"><span class="hs-identifier hs-var">negateFloat#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500333"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundFloatInteger"><span class="hs-pragma hs-type">roundFloatInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-181"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundFloatInteger"><span class="hs-identifier hs-type">roundFloatInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-182"></span><span id="roundFloatInteger"><span class="annot"><span class="annottext">roundFloatInteger :: Float -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#roundFloatInteger"><span class="hs-identifier hs-var hs-var">roundFloatInteger</span></a></span></span><span> </span><span id="local-6989586621679500332"><span class="annot"><span class="annottext">Float
</span><a href="#local-6989586621679500332"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Float -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#float2Integer"><span class="hs-identifier hs-var">float2Integer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float -&gt; Float
</span><a href="GHC.Float.RealFracMethods.html#c_rintFloat"><span class="hs-identifier hs-var">c_rintFloat</span></a></span><span> </span><span class="annot"><span class="annottext">Float
</span><a href="#local-6989586621679500332"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>
</span><span id="line-184"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-185"></span><span class="hs-comment">--                              Double Methods                              --</span><span>
</span><span id="line-186"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span class="hs-comment">-- Special Functions for Int, nice, easy and fast.</span><span>
</span><span id="line-189"></span><span class="hs-comment">-- They should be small enough to be inlined automatically.</span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span class="hs-comment">-- We have to test for &#177;0.0 to avoid returning -0.0 in the second</span><span>
</span><span id="line-192"></span><span class="hs-comment">-- component of the pair. Unfortunately the branching costs a lot</span><span>
</span><span id="line-193"></span><span class="hs-comment">-- of performance.</span><span>
</span><span id="line-194"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionDoubleInt"><span class="hs-identifier hs-type">properFractionDoubleInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-195"></span><span id="properFractionDoubleInt"><span class="annot"><span class="annottext">properFractionDoubleInt :: Double -&gt; (Int, Double)
</span><a href="GHC.Float.RealFracMethods.html#properFractionDoubleInt"><span class="hs-identifier hs-var hs-var">properFractionDoubleInt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-type">D#</span></a></span><span> </span><span id="local-6989586621679500330"><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500330"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500330"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3D%3D%23%23"><span class="hs-operator hs-var">==##</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><span class="hs-number">0.0##</span></span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double
</span><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-var">D#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><span class="hs-number">0.0##</span></span><span class="hs-special">)</span><span>
</span><span id="line-198"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#double2Int%23"><span class="hs-identifier hs-var">double2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500330"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-199"></span><span>                </span><span id="local-6989586621679500329"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500329"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500329"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double
</span><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-var">D#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500330"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double# -&gt; Double#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23%23"><span class="hs-operator hs-var">-##</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Double#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Double%23"><span class="hs-identifier hs-var">int2Double#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500329"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-200"></span><span>
</span><span id="line-201"></span><span class="hs-comment">-- truncateDoubleInt = double2Int</span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorDoubleInt"><span class="hs-identifier hs-type">floorDoubleInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-204"></span><span id="floorDoubleInt"><span class="annot"><span class="annottext">floorDoubleInt :: Double -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#floorDoubleInt"><span class="hs-identifier hs-var hs-var">floorDoubleInt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-type">D#</span></a></span><span> </span><span id="local-6989586621679500328"><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500328"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-205"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#double2Int%23"><span class="hs-identifier hs-var">double2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500328"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-206"></span><span>      </span><span id="local-6989586621679500327"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500327"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500328"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23%23"><span class="hs-operator hs-var">&lt;##</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Double#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Double%23"><span class="hs-identifier hs-var">int2Double#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500327"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500327"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">1#</span></span><span class="hs-special">)</span><span>
</span><span id="line-207"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500327"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingDoubleInt"><span class="hs-identifier hs-type">ceilingDoubleInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-210"></span><span id="ceilingDoubleInt"><span class="annot"><span class="annottext">ceilingDoubleInt :: Double -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#ceilingDoubleInt"><span class="hs-identifier hs-var hs-var">ceilingDoubleInt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-type">D#</span></a></span><span> </span><span id="local-6989586621679500326"><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500326"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-211"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#double2Int%23"><span class="hs-identifier hs-var">double2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500326"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-212"></span><span>      </span><span id="local-6989586621679500325"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500325"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Double#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Double%23"><span class="hs-identifier hs-var">int2Double#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500325"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23%23"><span class="hs-operator hs-var">&lt;##</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500326"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500325"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%2B%23"><span class="hs-operator hs-var">+#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">1#</span></span><span class="hs-special">)</span><span>
</span><span id="line-213"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500325"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundDoubleInt"><span class="hs-identifier hs-type">roundDoubleInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-216"></span><span id="roundDoubleInt"><span class="annot"><span class="annottext">roundDoubleInt :: Double -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#roundDoubleInt"><span class="hs-identifier hs-var hs-var">roundDoubleInt</span></a></span></span><span> </span><span id="local-6989586621679500324"><span class="annot"><span class="annottext">Double
</span><a href="#local-6989586621679500324"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Double -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#double2Int"><span class="hs-identifier hs-var">double2Int</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double -&gt; Double
</span><a href="GHC.Float.RealFracMethods.html#c_rintDouble"><span class="hs-identifier hs-var">c_rintDouble</span></a></span><span> </span><span class="annot"><span class="annottext">Double
</span><a href="#local-6989586621679500324"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span class="hs-comment">-- Functions with Integer results</span><span>
</span><span id="line-219"></span><span>
</span><span id="line-220"></span><span class="hs-comment">-- The new Code generator isn't quite as good for the old 'Double' code</span><span>
</span><span id="line-221"></span><span class="hs-comment">-- as for the 'Float' code, so for 'Double' the bit-fiddling also wins</span><span>
</span><span id="line-222"></span><span class="hs-comment">-- when the values have small modulus.</span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span class="hs-comment">-- When the exponent is negative, all mantissae have less than 64 bits</span><span>
</span><span id="line-225"></span><span class="hs-comment">-- and the right shifting of sized types is much faster than that of</span><span>
</span><span id="line-226"></span><span class="hs-comment">-- 'Integer's, especially when we can</span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span class="hs-comment">-- Note: For negative exponents, we must check the validity of the shift</span><span>
</span><span id="line-229"></span><span class="hs-comment">-- distance for the right shifts of the mantissa.</span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionDoubleInteger"><span class="hs-pragma hs-type">properFractionDoubleInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-232"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#properFractionDoubleInteger"><span class="hs-identifier hs-type">properFractionDoubleInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-233"></span><span id="properFractionDoubleInteger"><span class="annot"><span class="annottext">properFractionDoubleInteger :: Double -&gt; (Integer, Double)
</span><a href="GHC.Float.RealFracMethods.html#properFractionDoubleInteger"><span class="hs-identifier hs-var hs-var">properFractionDoubleInteger</span></a></span></span><span> </span><span id="local-6989586621679500322"><span class="annot"><span class="annottext">v :: Double
</span><a href="#local-6989586621679500322"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-type">D#</span></a></span><span> </span><span id="local-6989586621679500321"><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500321"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-234"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; (# Integer, Int# #)
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerDecodeDouble%23"><span class="hs-identifier hs-var">integerDecodeDouble#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500321"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-235"></span><span>      </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679500319"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500319"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679500318"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500318"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-236"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500318"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23"><span class="hs-operator hs-var">&lt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-237"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500318"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-238"></span><span>            </span><span id="local-6989586621679500317"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500317"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500317"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%23"><span class="hs-operator hs-var">&gt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">52#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Double
</span><a href="#local-6989586621679500322"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-239"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500319"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span>                 </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-240"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">TO64</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">integerNegate</span><span> </span><span class="hs-identifier">m</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-241"></span><span>                  </span><span id="local-6989586621679500315"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500315"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-242"></span><span>                    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500315"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="GHC.Float.RealFracMethods.html#uncheckedIShiftRA64%23"><span class="hs-operator hs-var">`uncheckedIShiftRA64#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500317"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-243"></span><span>                      </span><span id="local-6989586621679500314"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500314"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-244"></span><span>                        </span><span class="hs-special">(</span><span class="hs-identifier">FROM64</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">NEGATE64</span><span> </span><span class="hs-identifier">k</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-245"></span><span>                          </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">MINUS64</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500314"><span class="hs-special hs-var">(</span></a></span><span class="hs-identifier">k</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">uncheckedIShiftL64#</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">s</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-246"></span><span>                            </span><span id="local-6989586621679500313"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500313"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-247"></span><span>                              </span><span class="annot"><span class="annottext">Double# -&gt; Double
</span><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-var">D#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int# -&gt; Double#
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerEncodeDouble%23"><span class="hs-identifier hs-var">integerEncodeDouble#</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-identifier">FROM64</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">NEGATE64</span><span> </span><span class="hs-identifier">r</span><span class="hs-special">)</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500318"><span class="hs-special hs-var">)</span></a></span><span> </span><span class="hs-identifier">e</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-248"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-249"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">TO64</span><span> </span><span class="hs-identifier">m</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-250"></span><span>                  </span><span id="local-6989586621679500312"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500312"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-251"></span><span>                    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500312"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="GHC.Float.RealFracMethods.html#uncheckedIShiftRA64%23"><span class="hs-operator hs-var">`uncheckedIShiftRA64#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500317"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-252"></span><span>                      </span><span id="local-6989586621679500311"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500311"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">FROM64</span><span> </span><span class="hs-identifier">k</span><span class="hs-special">,</span><span>
</span><span id="line-253"></span><span>                            </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">MINUS64</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500311"><span class="hs-special hs-var">(</span></a></span><span class="hs-identifier">k</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">uncheckedIShiftL64#</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">s</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-254"></span><span>                              </span><span id="local-6989586621679500310"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500310"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double
</span><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-var">D#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int# -&gt; Double#
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerEncodeDouble%23"><span class="hs-identifier hs-var">integerEncodeDouble#</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-identifier">FROM64</span><span> </span><span class="hs-identifier">r</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">e</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Word# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftL%23"><span class="hs-identifier hs-var">integerShiftL#</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500319"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500318"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double
</span><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-var">D#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><span class="hs-number">0.0##</span></span><span class="hs-special">)</span><span>
</span><span id="line-256"></span><span>
</span><span id="line-257"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#truncateDoubleInteger"><span class="hs-pragma hs-type">truncateDoubleInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-258"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#truncateDoubleInteger"><span class="hs-identifier hs-type">truncateDoubleInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-259"></span><span id="truncateDoubleInteger"><span class="annot"><span class="annottext">truncateDoubleInteger :: Double -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#truncateDoubleInteger"><span class="hs-identifier hs-var hs-var">truncateDoubleInteger</span></a></span></span><span> </span><span id="local-6989586621679500309"><span class="annot"><span class="annottext">Double
</span><a href="#local-6989586621679500309"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-260"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Double -&gt; (Integer, Double)
</span><a href="GHC.Float.RealFracMethods.html#properFractionDoubleInteger"><span class="hs-identifier hs-var">properFractionDoubleInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Double
</span><a href="#local-6989586621679500309"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-261"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621679500308"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500308"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Double
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500308"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span class="hs-comment">-- floor is easier for negative numbers than truncate, so this gets its</span><span>
</span><span id="line-264"></span><span class="hs-comment">-- own implementation, it's a little faster.</span><span>
</span><span id="line-265"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorDoubleInteger"><span class="hs-pragma hs-type">floorDoubleInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-266"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#floorDoubleInteger"><span class="hs-identifier hs-type">floorDoubleInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-267"></span><span id="floorDoubleInteger"><span class="annot"><span class="annottext">floorDoubleInteger :: Double -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#floorDoubleInteger"><span class="hs-identifier hs-var hs-var">floorDoubleInteger</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-type">D#</span></a></span><span> </span><span id="local-6989586621679500307"><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500307"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-268"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; (# Integer, Int# #)
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerDecodeDouble%23"><span class="hs-identifier hs-var">integerDecodeDouble#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500307"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-269"></span><span>      </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679500306"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500306"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679500305"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500305"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-270"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500305"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23"><span class="hs-operator hs-var">&lt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-271"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500305"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-272"></span><span>            </span><span id="local-6989586621679500304"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500304"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500304"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%23"><span class="hs-operator hs-var">&gt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">52#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500306"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span>
</span><span id="line-273"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-274"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">TO64</span><span> </span><span class="hs-identifier">m</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-275"></span><span>                  </span><span id="local-6989586621679500303"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500303"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FROM64</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">n</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">uncheckedIShiftRA64#</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">s</span><span class="hs-special">)</span><span>
</span><span id="line-276"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftL%23"><span class="hs-identifier hs-var">integerShiftL#</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500306"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500305"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>
</span><span id="line-278"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingDoubleInteger"><span class="hs-pragma hs-type">ceilingDoubleInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-279"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#ceilingDoubleInteger"><span class="hs-identifier hs-type">ceilingDoubleInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-280"></span><span id="ceilingDoubleInteger"><span class="annot"><span class="annottext">ceilingDoubleInteger :: Double -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#ceilingDoubleInteger"><span class="hs-identifier hs-var hs-var">ceilingDoubleInteger</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-type">D#</span></a></span><span> </span><span id="local-6989586621679500302"><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500302"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-281"></span><span>    </span><span class="annot"><span class="annottext">Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerNegate"><span class="hs-identifier hs-var">integerNegate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#floorDoubleInteger"><span class="hs-identifier hs-var">floorDoubleInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double# -&gt; Double
</span><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-var">D#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double# -&gt; Double#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateDouble%23"><span class="hs-identifier hs-var">negateDouble#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500302"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-282"></span><span>
</span><span id="line-283"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundDoubleInteger"><span class="hs-pragma hs-type">roundDoubleInteger</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-284"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#roundDoubleInteger"><span class="hs-identifier hs-type">roundDoubleInteger</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-285"></span><span id="roundDoubleInteger"><span class="annot"><span class="annottext">roundDoubleInteger :: Double -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#roundDoubleInteger"><span class="hs-identifier hs-var hs-var">roundDoubleInteger</span></a></span></span><span> </span><span id="local-6989586621679500301"><span class="annot"><span class="annottext">Double
</span><a href="#local-6989586621679500301"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Double -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#double2Integer"><span class="hs-identifier hs-var">double2Integer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double -&gt; Double
</span><a href="GHC.Float.RealFracMethods.html#c_rintDouble"><span class="hs-identifier hs-var">c_rintDouble</span></a></span><span> </span><span class="annot"><span class="annottext">Double
</span><a href="#local-6989586621679500301"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-286"></span><span>
</span><span id="line-287"></span><span class="hs-comment">-- Wrappers around double2Int#, int2Double#, float2Int# and int2Float#,</span><span>
</span><span id="line-288"></span><span class="hs-comment">-- we need them here, so we move them from GHC.Float and re-export them</span><span>
</span><span id="line-289"></span><span class="hs-comment">-- explicitly from there.</span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#double2Int"><span class="hs-identifier hs-type">double2Int</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-292"></span><span id="double2Int"><span class="annot"><span class="annottext">double2Int :: Double -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#double2Int"><span class="hs-identifier hs-var hs-var">double2Int</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-type">D#</span></a></span><span> </span><span id="local-6989586621679500299"><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500299"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Double# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#double2Int%23"><span class="hs-identifier hs-var">double2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500299"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-293"></span><span>
</span><span id="line-294"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#int2Double"><span class="hs-identifier hs-type">int2Double</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span>
</span><span id="line-295"></span><span id="int2Double"><span class="annot"><span class="annottext">int2Double :: Int -&gt; Double
</span><a href="GHC.Float.RealFracMethods.html#int2Double"><span class="hs-identifier hs-var hs-var">int2Double</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679500298"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500298"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; Double
</span><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-var">D#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Double#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Double%23"><span class="hs-identifier hs-var">int2Double#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500298"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-296"></span><span>
</span><span id="line-297"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#float2Int"><span class="hs-identifier hs-type">float2Int</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-298"></span><span id="float2Int"><span class="annot"><span class="annottext">float2Int :: Float -&gt; Int
</span><a href="GHC.Float.RealFracMethods.html#float2Int"><span class="hs-identifier hs-var hs-var">float2Int</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-type">F#</span></a></span><span> </span><span id="local-6989586621679500297"><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500297"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Float# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#float2Int%23"><span class="hs-identifier hs-var">float2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500297"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-299"></span><span>
</span><span id="line-300"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#int2Float"><span class="hs-identifier hs-type">int2Float</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span>
</span><span id="line-301"></span><span id="int2Float"><span class="annot"><span class="annottext">int2Float :: Int -&gt; Float
</span><a href="GHC.Float.RealFracMethods.html#int2Float"><span class="hs-identifier hs-var hs-var">int2Float</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679500296"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500296"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; Float
</span><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-var">F#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Float#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Float%23"><span class="hs-identifier hs-var">int2Float#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500296"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-302"></span><span>
</span><span id="line-303"></span><span class="hs-comment">-- Quicker conversions from 'Double' and 'Float' to 'Integer',</span><span>
</span><span id="line-304"></span><span class="hs-comment">-- assuming the floating point value is integral.</span><span>
</span><span id="line-305"></span><span class="hs-comment">--</span><span>
</span><span id="line-306"></span><span class="hs-comment">-- Note: Since the value is integral, the exponent can't be less than</span><span>
</span><span id="line-307"></span><span class="hs-comment">-- (-TYP_MANT_DIG), so we need not check the validity of the shift</span><span>
</span><span id="line-308"></span><span class="hs-comment">-- distance for the right shifts here.</span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#double2Integer"><span class="hs-pragma hs-type">double2Integer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-311"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#double2Integer"><span class="hs-identifier hs-type">double2Integer</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-312"></span><span id="double2Integer"><span class="annot"><span class="annottext">double2Integer :: Double -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#double2Integer"><span class="hs-identifier hs-var hs-var">double2Integer</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#D%23"><span class="hs-identifier hs-type">D#</span></a></span><span> </span><span id="local-6989586621679500295"><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500295"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-313"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Double# -&gt; (# Integer, Int# #)
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerDecodeDouble%23"><span class="hs-identifier hs-var">integerDecodeDouble#</span></a></span><span> </span><span class="annot"><span class="annottext">Double#
</span><a href="#local-6989586621679500295"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-314"></span><span>      </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679500294"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500294"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679500293"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500293"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-315"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500293"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23"><span class="hs-operator hs-var">&lt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-316"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">TO64</span><span> </span><span class="hs-identifier">m</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-317"></span><span>            </span><span id="local-6989586621679500292"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500292"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FROM64</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">n</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">uncheckedIShiftRA64#</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">negateInt#</span><span> </span><span class="hs-identifier">e</span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftL%23"><span class="hs-identifier hs-var">integerShiftL#</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679500294"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500293"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-319"></span><span>
</span><span id="line-320"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Float.RealFracMethods.html#float2Integer"><span class="hs-pragma hs-type">float2Integer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-321"></span><span class="annot"><a href="GHC.Float.RealFracMethods.html#float2Integer"><span class="hs-identifier hs-type">float2Integer</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-322"></span><span id="float2Integer"><span class="annot"><span class="annottext">float2Integer :: Float -&gt; Integer
</span><a href="GHC.Float.RealFracMethods.html#float2Integer"><span class="hs-identifier hs-var hs-var">float2Integer</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#F%23"><span class="hs-identifier hs-type">F#</span></a></span><span> </span><span id="local-6989586621679500291"><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500291"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-323"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Float# -&gt; (# Int#, Int# #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#decodeFloat_Int%23"><span class="hs-identifier hs-var">decodeFloat_Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Float#
</span><a href="#local-6989586621679500291"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-324"></span><span>      </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679500290"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500290"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679500289"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500289"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-325"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500289"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3C%23"><span class="hs-operator hs-var">&lt;#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500290"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftRA%23"><span class="hs-operator hs-var">`uncheckedIShiftRA#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500289"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-326"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftL%23"><span class="hs-identifier hs-var">integerShiftL#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500290"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679500289"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span class="hs-comment">-- Foreign imports, the rounding is done faster in C when the value</span><span>
</span><span id="line-329"></span><span class="hs-comment">-- isn't integral, so we call out for rounding. For values of large</span><span>
</span><span id="line-330"></span><span class="hs-comment">-- modulus, calling out to C is slower than staying in Haskell, but</span><span>
</span><span id="line-331"></span><span class="hs-comment">-- presumably 'round' is mostly called for values with smaller modulus,</span><span>
</span><span id="line-332"></span><span class="hs-comment">-- when calling out to C is a major win.</span><span>
</span><span id="line-333"></span><span class="hs-comment">-- For all other functions, calling out to C gives at most a marginal</span><span>
</span><span id="line-334"></span><span class="hs-comment">-- speedup for values of small modulus and is much slower than staying</span><span>
</span><span id="line-335"></span><span class="hs-comment">-- in Haskell for values of large modulus, so those are done in Haskell.</span><span>
</span><span id="line-336"></span><span>
</span><span id="line-337"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;rintDouble&quot;</span></span><span>
</span><span id="line-338"></span><span>    </span><span id="c_rintDouble"><span class="annot"><a href="GHC.Float.RealFracMethods.html#c_rintDouble"><span class="hs-identifier hs-var">c_rintDouble</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span>
</span><span id="line-339"></span><span>
</span><span id="line-340"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;rintFloat&quot;</span></span><span>
</span><span id="line-341"></span><span>    </span><span id="c_rintFloat"><span class="annot"><a href="GHC.Float.RealFracMethods.html#c_rintFloat"><span class="hs-identifier hs-var">c_rintFloat</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span>
</span><span id="line-342"></span><span>
</span><span id="line-343"></span></pre></body></html>